<!--
 * @Author: GKN
 * @Date: 2023-07-25 14:28:00
 * @LastEditTime: 2023-11-06 11:12:30
 * @LastEditors: GKN
 * @Description: 
 * @FilePath: \mod\src\view\components\ad.vue
 * 可以输入预定的版权声明、个性签名、空行等
-->
<template>
    <div class="cont">
      <el-image
        style="width: 100%; height: 100%"
        :src="url"
        fit="cover"></el-image>
      <div @click="close" :class="props.direction == 'right'?'close1':'close2'">X</div>
    </div>
  </template>
  
  <script setup>
  import { ref,getCurrentInstance } from "vue";
  const { proxy } = getCurrentInstance();
  import httpApi from '@/api/http'
  import api from '@/api/api'
  const props = defineProps({
      type: {
          type: String,
          default: "",
      },
      direction:{
          type: String,
          default: "",
      },
  })
  let emit = defineEmits(["titleClick"]);
  const close = () => {
    emit("close");
  };
  const url = ref('')
  const getAd=()=>{
    proxy.$http.request(proxy.$api.list_advert+'?mark=1','get',{},false, function (res) {
      if(res&&res.data){
        const list = res.data.data.list
        // 右边广告
        if(props.type == 'r'){
          url.value = "https://img.zgcxcgk.com/"+list[1].img
        }
        // 左边广告
        if(props.type == 'l'){
          
        }
      }
    })
  }
  getAd()
  </script>
  
  <style lang='less' scoped>
  
  </style>
  
  
